package com.seres.gate.vo;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.seres.client.model.user.SysMenu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * @author Tan-Bowen
 * @version 1.0
 * @description TODO
 * @date 2021/8/2 17:02
 */
public class MenuVo {


    @Data
    @Builder
    public static class MenuAndAuth {

        private List<String> auth;

        private List<SysMenu> menus;

        private List<String> urls;

    }

    @Data
    @Builder
    public static class MenuAuthMap {

        private List<SysMenu> auth;

        private List<SysMenu> menus;

    }

    @Data
    @Builder
    public static class MenuAuthId {

        private List<Long> auth;

        private List<Long> menus;

    }

    @Data
    @Builder
    @ApiModel("菜单信息新增")
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Create {
        @ApiModelProperty("名称")
        private String name;

        @NotNull(message = "上级菜单必填")
        @ApiModelProperty("父级id")
        private Long pid;

        @NotNull(message = "菜单类型必选")
        @ApiModelProperty("0 菜单, 1 功能接口")
        private Integer type;

//        @NotBlank(message = "菜单路径必填")
        @ApiModelProperty("路径")
        private String path;

        //        @NotNull(message = "菜单路由必填")
        @ApiModelProperty("全路由")
        private String router;

        //        @NotBlank(message = "菜单路径必填")
        @ApiModelProperty("权限标识")
        private String permissions;

        @ApiModelProperty("绑定的接口")
        private String url;

        @ApiModelProperty("图标")
        private String icon;

        @NotNull(message = "菜单状态必填")
        @ApiModelProperty("1启用 0禁用")
        private Integer state;

        @NotNull(message = "菜单排序必填")
        @ApiModelProperty("排序")
        private Integer sort;

        @ApiModelProperty("创建时间")
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        private Date createTime;

        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        private Date updateTime;

        @ApiModelProperty("创建人")
        private Long createUser;
    }


    @Data
    @ApiModel("菜单信息修改")
//    @NoArgsConstructor
//    @AllArgsConstructor
    @EqualsAndHashCode(callSuper = true)
    public static class Update extends Create {

        @NotNull(message = "主键id不能为空")
        private Long id;
    }

    @Data
    @Builder
    @ApiModel("菜单信息查询")
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Select {

        @ApiModelProperty("父级id")
        private Long pid;

        @ApiModelProperty("0 菜单, 1 功能接口")
        private Integer type;

        @ApiModelProperty("绑定的接口")
        private String url;

    }

    @Data
    @Builder
    @ApiModel("菜单信息分页")
    @NoArgsConstructor
    @AllArgsConstructor
    public static class PageList {
        private Long id;

        @ApiModelProperty("名称")
        private String name;

        @ApiModelProperty("父级id")
        private Long pid;

        @ApiModelProperty("0 菜单, 1 功能接口")
        private Integer type;

        @ApiModelProperty("路径")
        private String path;

        @ApiModelProperty("全路由")
        private String router;

        @ApiModelProperty("权限标识")
        private String permissions;

        @ApiModelProperty("绑定")
        private String url;

        @ApiModelProperty("图标")
        private String icon;

        @ApiModelProperty("1启用 0禁用")
        private Integer state;

        @ApiModelProperty("排序")
        private Integer sort;

        @ApiModelProperty("创建时间")
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        private Date createTime;

        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        private Date updateTime;

        @ApiModelProperty("创建人")
        private Long createUser;

        @ApiModelProperty("创建人名称")
        private String createName;
    }

}
